<!--
 * @description  : 涉案物资查询
 * @descriptionDetail: 涉案物资查询
 * @copyright    : 浙江烟草
 * @author       : dw
 * @create       : 2022-10-09 22:21:21
-->
<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar
      :is-white="false"
      :title="navTitle"
      :custom-back="goBack"
      style="z-index: 99999"
    >
    </theme-navbar>
    <!-- #endif -->
    <view class="content u-page">
      <!-- 内容区 -->
      <u-image class="head-img" :width="getImgWidth()" src="/static/internal/statistics_banner.png" mode="widthFix"></u-image>
      <view class="grid-lay">
        <u-grid :col="3" :border="false">
          <u-grid-item :index="index" v-for="(item,index) in list" :key="item.key" @click="gridClick">
            <u-image :src="item.iconPath" :width="120" mode="aspectFit" :height="120"></u-image>
            <view class="grid-text">
              {{ item.text }}
            </view>
          </u-grid-item>
        </u-grid>
      </view>
    </view>
	
	<!-- 组织机构选择 -->
	<u-popup mode="bottom" height="80%" v-model="orgSelectShow">
		<org-select :cleanParentOrg="true" :isHybrid="true" limitNodeType="all" treeType="zm-all" @choose="handlerChooseOrg"></org-select>
	</u-popup>
  </view>
</template>

<script>
export default {
  components: {

  },
  onLoad(){
    let opt = this.getRouteParam() || {};
    if(opt.from == 'caseQrCode'){
      if(!this.$u.test.isEmpty(opt.storeId)){
        this.$u.route({
          url: '/pages/store/storeList',
          type: "to",
          params: {
            storeId: opt.storeId,
          },
        });
      }else{
        this.$u.toast('二维码识别失败');
      }
    }
  },
  data() {
    return {
      list: [
        {
          iconPath: '../../../static/store/stock.png',
          text: '案件趋势分析',
          bgColor: '#EBF2FF',
          key: 1,
          url: 'pages/internal/statisticsQuery/caseTrendsAnalysis',
        },
		{
		  iconPath: '../../../static/store/stock.png',
		  text: '零售户列表',
		  bgColor: '#EBF2FF',
		  key: 1,
		  url: 'pages/internal/statisticsQuery/retailerList',
		}
      ],
	  orgSelectShow: false
    };
  },
  // 页面加载成功后也要设置一次，用于处理本页面刷新后失效问题
  mounted() {

  },
  methods: {
    gridClick(index){
      console.log(index)
      if(this.list[index].url){
        this.setRouteParam(this.list[index].text);
        this.$u.route(this.list[index].url);
      }
    },
    getImgWidth(){
      return (this.$u.sys().windowWidth - uni.upx2px(32)) + 'px';
    },
  },
};
</script>

<style lang="scss" scoped>
.head-img{
  width: 100%;
  padding: 16rpx 16rpx;
  margin: 0 auto;
}
.grid-lay{
	padding: 0 32rpx;
}
.grid-text{
	color: $u-main-color;
	margin-top: 24rpx;
	font-size: 30rpx;
}
</style>
